home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1986 July
/
1986-07.d64
/
seq file editor
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
116 lines
10 z$=chr$(20):a=3000:ifpeek(56)<64thena=100
20 dima$(a):print"[147]"chr$(14)chr$(8);:open1,0,0:v=203:ifpeek(771)=164thenv=212
30 li$="[163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163][163]"
40 print" [211]equential [198]ile [197]ditor":printli$""
50 print"[197]nter the name of the file you wish to edit and press [210][197][212][213][210][206]"
60 print">";:input#1,fi$:print"":fi$=left$(fi$,16)
70 print"filename is "chr$(34)fi$chr$(34):print"[201]s this correct? (y/n) y[157]";
80 input#1,a$:print:iflen(a$)=0thenprint"[145]":goto80
90 a$=left$(a$,1):ifa$="y"thenprint:goto110
100 run
110 print"[196]isk [196]rive # (8-10) 8[157]";:input#1,a$:dr=int(val(a$))
120 ifdr<8ordr>10thenprint:printspc(22)"[145] [145]":goto110
130 print"[147] [210]eading "chr$(34)fi$chr$(34):printli$
140 f2$=fi$+",s,r":ln=1:print" 1 : ";
150 open8,dr,8,f2$:get#8,a$
160 ifst<>0thenprint"[198]ile [206]ot [198]ound":gosub1150:gosub1140:run
170 goto190
180 get#8,a$
190 ifa$<>chr$(13)thena$(ln)=a$(ln)+a$
200 ifst<>0thengosub1150:goto260
210 ifa$=chr$(13)then230
220 printa$;:goto180
230 b$="":ifln<9thenb$=" "
240 print:ln=ln+1:printb$;ln": ";:ifst<>0then260
250 goto180
260 close8:print"[147]"spc(13)"[205]ain [205]enu":printli$
270 print"[1] [204]ist [198]ile":print"[2] [197]dit [204]ine":print"[3] [201]nsert [204]ine"
280 print"[4] [196]elete [204]ine":print"[5] [210]e-[210]un [208]rogram"
290 print"[6] [210]e-[211]ave [198]ile after [197]diting":print"[7] [208]rint [198]ile to [208]rinter"
300 print"[8] [197]xit [208]rogram"
310 print"[197]nter your choice and press [210][197][212][213][210][206]"
320 print">";:input#1,a$:a=int(val(a$)):ifa<1ora>8then260
330 onagoto340,520,600,700,800,830,890,1000
340 print"[147]"spc(13)"[204]ist [198]ile":printli$
350 print"[208]ress ([193]) to abort or ([211][208][193][195][197]) to pause"
360 print"([215][146])ith or [215]ith([207][146])ut line numbers? w[157]";
370 input#1,a$:a$=left$(a$,1):ifa$<>"w"anda$<>"o"then370
380 print"":forr=1toln:ifa$="o"then410
390 b$="":ifr<10thenb$=" "
400 printb$;r": ";
410 printa$(r)
420 fort=1to100:next
430 getc$:ifc$=""thennext:goto490
440 ifc$="a"thenprint:print"* [193]borted *":goto490
450 ifc$<>" "then430
460 print"* [208]aused *"
470 getc$:ifc$=""then470
480 print"[145] ":print"[145]";:goto430
490 print" [208]ress any key for [205]ain [205]enu"
500 getc$:ifc$=""then500
510 goto260
520 print"[147]"spc(13)"[197]dit [204]ine":printli$:print"[215]hich line number to edit? ";
530 input#1,a$:a=int(val(a$)):print
540 ifa>0anda<=lnthen560
550 print"[194]ad line number":gosub1150:goto520
560 print" "a$(a):print"[210]etype line or press [210][197][212][213][210][206]"
570 print">";:gosub1040:print
580 ift$=chr$(13)andp=0thenprint"[213]n-changed":gosub1150:goto260
590 print"[195]hanged":gosub1150:a$(a)=a$:goto260
600 print"[147]"spc(13)"[201]nsert a line":printli$
610 print"[215]here should the line be inserted?"
620 print">";:input#1,a$:a=int(val(a$)):print
630 ifa>0anda<=lnthen650
640 print:print"[194]ad line number":gosub1150:goto600
650 print"[215]hat would you like that line to be? (press [210][197][212][213][210][206] to abort)"
660 print">";:gosub1040
670 ift$=chr$(13)andp=0then260
680 forr=lntoastep-1:a$(r+1)=a$(r):next:ln=ln+1
690 print:print"[196]one":gosub1150:a$(a)=a$:goto260
700 print"[147]"spc(13)"[196]elete [204]ine":printli$
710 print"[215]hich line would you like to delete?"
720 print">";:input#1,a$:a=int(val(a$))
730 ifa<1ora>lnthen700
740 print:print:printa$(a):print"[196]elete this line (y/n)? y[157]";
750 input#1,a$:a$=left$(a$,1):print
760 ifa$="y"then780
770 print"[206]ot [196]eleted":gosub1150:goto260
780 forr=atoln:a$(r)=a$(r+1):next:ln=ln-1:print"[196]eleted"
790 gosub1150:goto260
800 print:print"[193]re you sure (y/n)? y[157]";:input#1,a$:a$=left$(a$,1)
810 ifa$="y"thenrun
820 goto260
830 print"[147]"spc(12)"[210]e-[211]ave [198]ile":printli$
840 print"[197]nter the file name":print"('*' for same name as before)"
850 f3$=fi$:print">";:input#1,a$:ifa$<>"*"thenf3$=a$
860 open15,dr,15,"s0:"+f3$:close15:f4$="0:"+f3$+",s,w":open8,dr,8,f4$
870 print"":forr=1toln:print"[204]ine: "r"[145]":print#8,a$(r):next
880 close8:print:print:print"[196]one":gosub1150:goto260
890 print"[147]"spc(13)"[208]rinting [198]ile":printli$
900 print"[200]ow many lines per page does your paper"
910 print"have? (0 = [195]ontinuous printing)"
920 print">";:input#1,lp:ll=0:iflp<0orlp<>int(lp)then890
930 print:print:print"[208]ress ([211]pace) to print or '[193]' to abort"
940 geta$:ifa$="a"then260
950 ifa$=" "then970
960 goto940
970 open9,4,7:forr=1to5:print#9:next:forr=1toln:print#9,a$(r)
980 ll=ll+1:ifll=lp-10thenfort=1to10:print#9:next:ll=0
990 next:print#9:close9:goto260
1000 print:print"[193]re you sure (y/n)? y[157]";
1010 input#1,a$:a$=left$(a$,1):ifa$="y"thenprint"[147]":end
1020 goto260
1030 rem return as a$
1040 p=0:a$=""
1050 printchr$(166)chr$(157);
1060 gett$:ift$=""or(t$=chr$(24)anda$="")then1060
1070 print" "chr$(157);
1080 ift$=z$andlen(a$)>0thena$=left$(a$,len(a$)-1):printt$;:p=p-1:goto1050
1090 ift$=chr$(24)thenforz=1tolen(a$):printz$;:next:goto1040
1100 ift$=chr$(13)thenprintt$:return
1110 if(asc(t$)and127)<32then1050
1120 ifp>253then1050
1130 printt$;:a$=a$+t$:pokev,0:p=p+1:goto1050
1140 open15,8,15:input#15,a$,b$,c$,d$:close15:return
1150 forr=1to1000:next:return